package com.junxonline.instant.common.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 登录日志类型枚举类
 *
 * @author JunX
 * @date 2021-07-13
 */
@Getter
@AllArgsConstructor
public enum LoginLogEnum {

    LOGIN("登录", 0),
    LOGOUT("登出", 1);

    /**
     * 标签
     */
    private final String label;

    /**
     * 值
     */
    private final Integer value;

    /**
     * 根据value获取枚举类对象
     *
     * @param value value
     * @return OperationEnum
     */
    public static LoginLogEnum getByValue(Integer value) {
        for (LoginLogEnum operationEnum : values()) {
            if (operationEnum.getValue().equals(value)) {
                return operationEnum;
            }
        }
        return null;
    }

    /**
     * 根据value获取枚举类对象的label
     *
     * @param value value
     * @return label
     */
    public static String valuesOf(Integer value) {
        for (LoginLogEnum operationEnum : values()) {
            if (operationEnum.getValue().equals(value)) {
                return operationEnum.getLabel();
            }
        }
        return null;
    }

}
